package com.fac.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 创建巡检记录DTO
 */
@Data
@ApiModel(description = "创建巡检记录请求参数")
public class InspectionRecordCreateDTO implements Serializable {

    @NotNull(message = "计划ID不能为空")
    @ApiModelProperty(value = "计划ID", example = "1", required = true)
    private Long planId;

    @NotNull(message = "设备ID不能为空")
    @ApiModelProperty(value = "设备ID", example = "1", required = true)
    private Long equipmentId;

    @NotEmpty(message = "巡检结果不能为空")
    @Valid
    @ApiModelProperty(value = "巡检结果列表", required = true)
    private List<InspectionResult> result;

    @ApiModelProperty(value = "异常描述", example = "设备外壳有轻微磨损")
    private String abnormalDescription;

    @ApiModelProperty(value = "处理建议", example = "建议更换外壳")
    private String handlingSuggestions;

    @Data
    @ApiModel(description = "巡检结果")
    public static class InspectionResult {
        @NotBlank(message = "项目名称不能为空")
        @ApiModelProperty(value = "项目名称", example = "外观检查", required = true)
        private String itemName;

        @NotBlank(message = "检查结果不能为空")
        @ApiModelProperty(value = "检查结果", example = "完好", required = true)
        private String checkResult;

        @ApiModelProperty(value = "照片列表", example = "[\"photo1.jpg\",\"photo2.jpg\"]")
        private List<String> photos;
    }
} 